﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace MLO
{
    public class Item : Object
    {
        public string Text { get; set; }
        public Slot Content { get; set; }
        public Item(Slot slot, string text)
        {
            Content = slot;
            Text = text;
        }
        public override string ToString()
        {
            return Text;
        }
    }
    public class Production
    {
        private Slot _slot;
        public Production(Slot slot)
        {
            _slot = slot;            
        }
        public Item Item { get; set; }
        public string Operation { get; set; }
        public CommonLib.ValueType Type
        {
            get
            {
                if ((Item.Content as Slot).Domain != null)
                    switch ((Item.Content as Slot).Domain.Type)
                    {
                        case CommonLib.DomainType.Enum:
                            return CommonLib.ValueType.Enum;
                        case CommonLib.DomainType.Number:
                            int temp=0;
                            if (Value == null) return CommonLib.ValueType.None;
                            if (int.TryParse(Value.Text, out temp))
                                return CommonLib.ValueType.Int;
                            else
                                return CommonLib.ValueType.IntVar;
                    }
                return CommonLib.ValueType.Frame;
            }
            set
            { }
        }
        public Item Value { get; set; }
    }
}
